//
//  DSSHTaskTableVC.m
//  DSSH
//
//  Created by lcy on 16/3/29.
//  Copyright © 2016年 lcy. All rights reserved.
//

#import "DSSHTaskTableVC.h"
#import "MeTakeCell.h"
@interface DSSHTaskTableVC ()<UITableViewDataSource,UITableViewDelegate>
@property(nonatomic,strong)UITableView* taskTableView;
@end

@implementation DSSHTaskTableVC

- (void)viewDidLoad {
    [super viewDidLoad];
    [self setupViewAndData];
    // Do any additional setup after loading the view.
}
-(void)setupViewAndData
{
    self.view.backgroundColor = [UIColor whiteColor];
    self.taskTableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, ZYAppWidth, ZYAppHeight-44*2*HIGHT_SCALE-5*HIGHT_SCALE-64) style:UITableViewStylePlain];
    self.taskTableView.delegate = self;
    self.taskTableView.dataSource = self;
    [self.view addSubview:self.taskTableView];
}
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 4;
}
-(UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    MeTakeCell * cell = [tableView dequeueReusableCellWithIdentifier:@"cellID"];
    if (!cell)
    {
        cell = [[NSBundle mainBundle]loadNibNamed:@"MeTakeCell" owner:nil options:nil][0];
    }
    return cell;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 285;
}
-(UIView*)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
{
    UIView * footView = [[UIView alloc]init];
    footView.backgroundColor = [UIColor whiteColor];
    UILabel * numLabel = [[UILabel alloc]initWithFrame:CGRectMake((ZYAppWidth-100*WIDTH_SCALE)/2, 7*HIGHT_SCALE, 100*WIDTH_SCALE, 30*HIGHT_SCALE)];
    numLabel.textAlignment = NSTextAlignmentCenter;
    numLabel.text = @"共24个任务";
    numLabel.font = FONT(13);
    [footView addSubview:numLabel];
    
    UILabel * yuanLabel = [[UILabel alloc]init];
    yuanLabel.text = @"元";
    yuanLabel.font = FONT(13);
    yuanLabel.frame = CGRectMake(ZYAppWidth-30*WIDTH_SCALE, 7*HIGHT_SCALE, 20*WIDTH_SCALE, 30*HIGHT_SCALE);
    [footView addSubview:yuanLabel];
    
    UILabel * moneyLabel = [[UILabel alloc]initWithFrame:CGRectMake(ZYAppWidth-30*WIDTH_SCALE-10*WIDTH_SCALE-60*WIDTH_SCALE, 7*HIGHT_SCALE, 60*WIDTH_SCALE, 30*HIGHT_SCALE)];
    moneyLabel.text = @"$ 1880";
    moneyLabel.textAlignment = NSTextAlignmentRight;
    moneyLabel.textColor = [UIColor redColor];
    moneyLabel.font = FONT(13);
    [footView addSubview:moneyLabel];
    UILabel * textLabel = [[UILabel alloc]initWithFrame:CGRectMake(ZYAppWidth-30*WIDTH_SCALE-10*WIDTH_SCALE-60*WIDTH_SCALE-45*WIDTH_SCALE, 7*HIGHT_SCALE, 40*WIDTH_SCALE, 30*HIGHT_SCALE)];
    textLabel.text = @"合计：";
    textLabel.textAlignment = NSTextAlignmentRight;
    textLabel.font = FONT(13);
    [footView addSubview:textLabel];
    return footView;
}
-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
{
    return 44*HIGHT_SCALE;
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
